//
//  ImageDownloader.h
//  iPay
//
//  Created by apple on 11-8-3.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>

@protocol  ImageDownloaderDelegate;

@interface ImageDownloader : NSObject {
    id <ImageDownloaderDelegate> delegate;
    
    NSMutableData *activeDownload;
    NSURLConnection *imageConnection;
	
	NSString *imageURL;
	BOOL imageCacheable;
	int tag;

	NSIndexPath *indexPath;
}

@property (nonatomic, assign) id <ImageDownloaderDelegate> delegate;

@property (nonatomic, retain) NSMutableData *activeDownload;
@property (nonatomic, retain) NSURLConnection *imageConnection;
@property (nonatomic, retain) NSIndexPath *indexPath;

@property (nonatomic, copy) NSString *imageURL;
@property (nonatomic, assign) int tag;

- (void)startDownload:(BOOL)cacheable;
- (void)cancelDownload;

@end

@protocol ImageDownloaderDelegate<NSObject>

@optional
- (void)appImageDidLoad:(UIImage *)image withTag:(int)tag;
- (void)appImageDidLoad:(UIImage *)image withIndexPath:(NSIndexPath *)indexPath;
- (void)openActiovityIndicator:(int)tag;
- (void)closeActiovityIndicator:(int)tag;
- (void)openActiovityIndicatorCell:(NSIndexPath *)indexPath;
- (void)closeActiovityIndicatorCell:(NSIndexPath *)indexPath;

@end
